package com.pactera.spring.boot.learn.service.impl;

import com.pactera.spring.boot.learn.dto.UserDataDTO;
import com.pactera.spring.boot.learn.entity.User;
import com.pactera.spring.boot.learn.vo.UserDataVO;
import com.pactera.spring.boot.learn.service.IUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pactera.spring.boot.learn.mapper.UserMapper;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements IUserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public Boolean updUser(UserDataDTO user) {
        return true;
    }

    @Override
    public List<UserDataVO> getUserList(UserDataDTO dto) {
        return userMapper.getUserList(dto);
    }

    @Override
    public Boolean insertUser(UserDataDTO dto) {
        User user = new User();
        BeanUtils.copyProperties(dto, user);
        return userMapper.insertUser(user) > 0;
    }

    @Override
    public Boolean delUser(Integer id){
        return userMapper.delUser(id);
    }



}
